﻿@{
    ViewBag.Title = "Home Page";
}
@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
                <h2>@ViewBag.Message</h2>
            </hgroup>
            <p>
                To learn more about ASP.NET MVC visit
                <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
                The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET MVC.
                If you have any questions about ASP.NET MVC visit
                <a href="http://forums.asp.net/1146.aspx/1?MVC" title="ASP.NET MVC Forum">our forums</a>.
            </p>
        </div>
    </section>
}
<ol id="catList">
</ol>

@section scripts{
    <script>
        $(function () {
            $.getJSON('/api/CatApi', null, function (data) {
                var catList = $("#catList");
                for (var i = 0; i < data.length; i++) {
                    var cat = data[i];
                    $("<li />").text(cat.Id + " - " + cat.Name).appendTo(catList);
                }
            });
        });
    </script>
}